#!/usr/bin/env python
# -*-coding:utf-8-*-
# File    : liyuqi.py

from flask import Flask, jsonify

app = Flask(__name__)

@app.route('/')
def index():
    return '这是一个小小的web程序'

@app.route('/user/<name>')
def user(name):
    users = [
{"name": "Tom", "age":"18", "sex":1},
{"name": "Coral", "age":"17", "sex":0},
{"name": "Kate", "age":"18", "sex":0}
]
    for user in users:
        user_name = user.get("name").lower()
        if user_name == name.lower():
            return jsonify(user)
    return jsonify({"error": "not found"})


if __name__ == '__main__':
    app.run()


